package com.example.doipandroidclient;

import android.util.Log;

import com.example.doipandroidclient.blueTooth.blueTooth.BlueToothDoipClient;

import org.bouncycastle.jce.provider.BouncyCastleProvider;

import java.security.KeyStore;
import java.security.Security;
import java.util.UUID;

import core.crypto.CertUtils;
import core.crypto.GlobalCertifications;

public class AndroidInitializer {

    static String TAG = "DOIP";
    public static final UUID DOIP_SERVICE_UUID = UUID.fromString("dddd0000-d01b-d01b-d01b-dddd00001111");
    static{
        try {
            init();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void init() throws Exception {
        Log.e(TAG,"init for android DOIP");
        if (Security.getProvider("BC") == null) {
            Security.addProvider(new BouncyCastleProvider());
        }
        GlobalCertifications.localKeyStore = KeyStore.getInstance("BKS");
        if(GlobalCertifications.localKeyStore == null){
            Log.e(TAG,"create BKS keystore instance failed");
            return;
        }
        CertUtils.setKeysCodec(new AndroidBase64Codec());
    }
}
